﻿using BDShop.DAL;
using BDShop.Entities;
using System;
using System.Collections.Generic;
using IsolationLevel = System.Transactions.IsolationLevel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BDShop.Business
{
    public class ProductImageService
    {
        public static List<ProductImage> Get5ByProductID(long id)
        {
            List<ProductImage> lstProductImage = new List<ProductImage>();
            using (var context = new BDShopEntities(IsolationLevel.ReadUncommitted))
            {
                lstProductImage = context.ProductImages.Where(p=>p.ProductID==id).OrderBy(p=>p.Order).Take(5).ToList();
            }

            return lstProductImage;
        }
    }
}
